<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=11"/>
<meta name="generator" content="Doxygen 1.9.4"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>miniFOC: hardware/flash.h File Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr id="projectrow">
  <td id="projectlogo"><img alt="Logo" src="Acme_LOGO.png"/></td>
  <td id="projectalign">
   <div id="projectname">miniFOC<span id="projectnumber">&#160;1.0.3</span>
   </div>
   <div id="projectbrief">This open-source project aims to accomplish a FOC(Field Oriented Control) scheme that is operatable with minimum costs in China.</div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.9.4 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
var searchBox = new SearchBox("searchBox", "search",'Search','.html');
/* @license-end */
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
$(function() {
  initMenu('',true,false,'search.php','Search');
  $(document).ready(function() { init_search(); });
});
/* @license-end */
</script>
<div id="main-nav"></div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div id="nav-path" class="navpath">
  <ul>
<li class="navelem"><a class="el" href="dir_42e555215cde261dd5295a864caa3e52.html">hardware</a></li>  </ul>
</div>
</div><!-- top -->
<div class="header">
  <div class="summary">
<a href="#func-members">Functions</a>  </div>
  <div class="headertitle"><div class="title">flash.h File Reference</div></div>
</div><!--header-->
<div class="contents">

<p>this is the header file of <a class="el" href="flash_8c.html" title="this file contains the code implementation of on-chip flash reading, writing and erasing,...">flash.c</a>.  
<a href="#details">More...</a></p>

<p><a href="flash_8h_source.html">Go to the source code of this file.</a></p>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a id="func-members" name="func-members"></a>
Functions</h2></td></tr>
<tr class="memitem:aa281b78d45017220d214a274f0c3e2c9"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="flash_8h.html#aa281b78d45017220d214a274f0c3e2c9">flash_write_parameters</a> (void)</td></tr>
<tr class="memdesc:aa281b78d45017220d214a274f0c3e2c9"><td class="mdescLeft">&#160;</td><td class="mdescRight">program all parameters to flash  <a href="flash_8h.html#aa281b78d45017220d214a274f0c3e2c9">More...</a><br /></td></tr>
<tr class="separator:aa281b78d45017220d214a274f0c3e2c9"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:aaef765344f91439176e3223a0f51f4d0"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="flash_8h.html#aaef765344f91439176e3223a0f51f4d0">flash_read_parameters</a> (void)</td></tr>
<tr class="memdesc:aaef765344f91439176e3223a0f51f4d0"><td class="mdescLeft">&#160;</td><td class="mdescRight">read all parameters from flash  <a href="flash_8h.html#aaef765344f91439176e3223a0f51f4d0">More...</a><br /></td></tr>
<tr class="separator:aaef765344f91439176e3223a0f51f4d0"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ac0d03d56de1c227449fe6628980cc12f"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="flash_8h.html#ac0d03d56de1c227449fe6628980cc12f">flash_erase_page</a> (void)</td></tr>
<tr class="memdesc:ac0d03d56de1c227449fe6628980cc12f"><td class="mdescLeft">&#160;</td><td class="mdescRight">erase flash page in last sector  <a href="flash_8h.html#ac0d03d56de1c227449fe6628980cc12f">More...</a><br /></td></tr>
<tr class="separator:ac0d03d56de1c227449fe6628980cc12f"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:af30bf1694be8902e66ba2f5e30791b48"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="flash_8h.html#af30bf1694be8902e66ba2f5e30791b48">flash_program_word</a> (unsigned int addr, unsigned int *data, unsigned char counter)</td></tr>
<tr class="memdesc:af30bf1694be8902e66ba2f5e30791b48"><td class="mdescLeft">&#160;</td><td class="mdescRight">program flash word to address  <a href="flash_8h.html#af30bf1694be8902e66ba2f5e30791b48">More...</a><br /></td></tr>
<tr class="separator:af30bf1694be8902e66ba2f5e30791b48"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a9b7a8ed62067617696d1fa44e1c3117c"><td class="memItemLeft" align="right" valign="top">unsigned int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="flash_8h.html#a9b7a8ed62067617696d1fa44e1c3117c">flash_read_word</a> (unsigned int addr)</td></tr>
<tr class="memdesc:a9b7a8ed62067617696d1fa44e1c3117c"><td class="mdescLeft">&#160;</td><td class="mdescRight">read flash word from address  <a href="flash_8h.html#a9b7a8ed62067617696d1fa44e1c3117c">More...</a><br /></td></tr>
<tr class="separator:a9b7a8ed62067617696d1fa44e1c3117c"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<div class="textblock"><p >this is the header file of <a class="el" href="flash_8c.html" title="this file contains the code implementation of on-chip flash reading, writing and erasing,...">flash.c</a>. </p>
<dl class="section author"><dt>Author</dt><dd>Lao·Zhu </dd></dl>
<dl class="section version"><dt>Version</dt><dd>V1.0.1 </dd></dl>
<dl class="section date"><dt>Date</dt><dd>10. October 2021 </dd></dl>

<p class="definition">Definition in file <a class="el" href="flash_8h_source.html">flash.h</a>.</p>
</div><h2 class="groupheader">Function Documentation</h2>
<a id="ac0d03d56de1c227449fe6628980cc12f" name="ac0d03d56de1c227449fe6628980cc12f"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ac0d03d56de1c227449fe6628980cc12f">&#9670;&nbsp;</a></span>flash_erase_page()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void flash_erase_page </td>
          <td>(</td>
          <td class="paramtype">void&#160;</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>erase flash page in last sector </p>

<p class="definition">Definition at line <a class="el" href="flash_8c_source.html#l00076">76</a> of file <a class="el" href="flash_8c_source.html">flash.c</a>.</p>

<p class="reference">References <a class="el" href="config_8h_source.html#l00044">FMC_WRITE_START_ADDR</a>.</p>

<p class="reference">Referenced by <a class="el" href="flash_8c_source.html#l00026">flash_write_parameters()</a>.</p>

</div>
</div>
<a id="af30bf1694be8902e66ba2f5e30791b48" name="af30bf1694be8902e66ba2f5e30791b48"></a>
<h2 class="memtitle"><span class="permalink"><a href="#af30bf1694be8902e66ba2f5e30791b48">&#9670;&nbsp;</a></span>flash_program_word()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void flash_program_word </td>
          <td>(</td>
          <td class="paramtype">unsigned int&#160;</td>
          <td class="paramname"><em>addr</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">unsigned int *&#160;</td>
          <td class="paramname"><em>data</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">unsigned char&#160;</td>
          <td class="paramname"><em>counter</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>program flash word to address </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramdir">[in]</td><td class="paramname">addr</td><td>address to write to </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">data</td><td>data to be written </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">counter</td><td>number of bytes to be written to flash </td></tr>
  </table>
  </dd>
</dl>

<p class="definition">Definition at line <a class="el" href="flash_8c_source.html#l00095">95</a> of file <a class="el" href="flash_8c_source.html">flash.c</a>.</p>

<p class="reference">References <a class="el" href="config_8h_source.html#l00044">FMC_WRITE_START_ADDR</a>.</p>

<p class="reference">Referenced by <a class="el" href="flash_8c_source.html#l00026">flash_write_parameters()</a>.</p>

</div>
</div>
<a id="aaef765344f91439176e3223a0f51f4d0" name="aaef765344f91439176e3223a0f51f4d0"></a>
<h2 class="memtitle"><span class="permalink"><a href="#aaef765344f91439176e3223a0f51f4d0">&#9670;&nbsp;</a></span>flash_read_parameters()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void flash_read_parameters </td>
          <td>(</td>
          <td class="paramtype">void&#160;</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>read all parameters from flash </p>

<p class="definition">Definition at line <a class="el" href="flash_8c_source.html#l00046">46</a> of file <a class="el" href="flash_8c_source.html">flash.c</a>.</p>

<p class="reference">References <a class="el" href="pid_8c_source.html#l00028">angle_pid_handler</a>, <a class="el" href="flash_8c_source.html#l00114">flash_read_word()</a>, <a class="el" href="foc_8c_source.html#l00028">foc_parameter_available_flag</a>, <a class="el" href="system_8c_source.html#l00070">int32_to_float()</a>, <a class="el" href="flash_8c_source.html#l00020">JUDGE_AVAILABLE</a>, <a class="el" href="pid_8h_source.html#l00027">PID_Structure_t::kd</a>, <a class="el" href="pid_8h_source.html#l00026">PID_Structure_t::ki</a>, <a class="el" href="pid_8h_source.html#l00025">PID_Structure_t::kp</a>, <a class="el" href="encoder_8c_source.html#l00023">machine_angle_offset</a>, <a class="el" href="foc_8c_source.html#l00024">phase_sequence</a>, <a class="el" href="pid_8c_source.html#l00016">pid_parameter_available_flag</a>, <a class="el" href="pid_8c_source.html#l00024">speed_pid_handler</a>, and <a class="el" href="pid_8h_source.html#l00032">PID_Structure_t::sum_maximum</a>.</p>

<p class="reference">Referenced by <a class="el" href="main_8c_source.html#l00139">main()</a>.</p>

</div>
</div>
<a id="a9b7a8ed62067617696d1fa44e1c3117c" name="a9b7a8ed62067617696d1fa44e1c3117c"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a9b7a8ed62067617696d1fa44e1c3117c">&#9670;&nbsp;</a></span>flash_read_word()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">unsigned int flash_read_word </td>
          <td>(</td>
          <td class="paramtype">unsigned int&#160;</td>
          <td class="paramname"><em>addr</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>read flash word from address </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramdir">[in]</td><td class="paramname">addr</td><td>address to read from </td></tr>
  </table>
  </dd>
</dl>
<dl class="retval"><dt>Return values</dt><dd>
  <table class="retval">
    <tr><td class="paramname">data</td><td>read from address </td></tr>
  </table>
  </dd>
</dl>

<p class="definition">Definition at line <a class="el" href="flash_8c_source.html#l00114">114</a> of file <a class="el" href="flash_8c_source.html">flash.c</a>.</p>

<p class="reference">References <a class="el" href="config_8h_source.html#l00044">FMC_WRITE_START_ADDR</a>.</p>

<p class="reference">Referenced by <a class="el" href="flash_8c_source.html#l00046">flash_read_parameters()</a>.</p>

</div>
</div>
<a id="aa281b78d45017220d214a274f0c3e2c9" name="aa281b78d45017220d214a274f0c3e2c9"></a>
<h2 class="memtitle"><span class="permalink"><a href="#aa281b78d45017220d214a274f0c3e2c9">&#9670;&nbsp;</a></span>flash_write_parameters()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void flash_write_parameters </td>
          <td>(</td>
          <td class="paramtype">void&#160;</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>program all parameters to flash </p>

<p class="definition">Definition at line <a class="el" href="flash_8c_source.html#l00026">26</a> of file <a class="el" href="flash_8c_source.html">flash.c</a>.</p>

<p class="reference">References <a class="el" href="pid_8c_source.html#l00028">angle_pid_handler</a>, <a class="el" href="flash_8c_source.html#l00076">flash_erase_page()</a>, <a class="el" href="flash_8c_source.html#l00095">flash_program_word()</a>, <a class="el" href="system_8c_source.html#l00060">float_to_int32()</a>, <a class="el" href="pid_8h_source.html#l00027">PID_Structure_t::kd</a>, <a class="el" href="pid_8h_source.html#l00026">PID_Structure_t::ki</a>, <a class="el" href="pid_8h_source.html#l00025">PID_Structure_t::kp</a>, <a class="el" href="encoder_8c_source.html#l00023">machine_angle_offset</a>, <a class="el" href="foc_8c_source.html#l00024">phase_sequence</a>, <a class="el" href="pid_8c_source.html#l00016">pid_parameter_available_flag</a>, <a class="el" href="pid_8c_source.html#l00024">speed_pid_handler</a>, and <a class="el" href="pid_8h_source.html#l00032">PID_Structure_t::sum_maximum</a>.</p>

<p class="reference">Referenced by <a class="el" href="main_8c_source.html#l00139">main()</a>.</p>

</div>
</div>
</div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated by&#160;<a href="https://www.doxygen.org/index.html"><img class="footer" src="doxygen.svg" width="104" height="31" alt="doxygen"/></a> 1.9.4
</small></address>
</body>
</html>
